prompt='Please input your name'
prompt+='\nif you input enough,input 0'
#设置循环因子
active=1

file_name='D:\\GITEE\\study_code\\Python\\2022-11-12\\guest_book.txt'
#打开文件
with open(file_name,'w') as file_object:
    while active:
        name=input(prompt)
        #判断是否写入文件
        if name!='0':#注意，input的返回值是字符串
            file_object.write(f"Hello,{name.title()}!\n")
        #改变循环因子，结束循环
        else:
            print("Input Termination.\n")
            active=0

            
